﻿using ExcelWordToHtml;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Preview.Controllers
{
    [Route("[controller]/[action]")]
    public class HomeController : Controller
    {
        [HttpGet]
        public async Task<IActionResult> Index(string url)
        {
            var result = string.Empty;
            if (url.Contains(".xls"))
            {
                result = await ExcelHelper.ToHtml(url);
            }
            if (url.Contains(".doc"))
            {
                result = await WordHelper.ToHtml(url);
            }
            ViewData["html"] = result;



            return View();
        }
    }
}
